function selectfix(element){
	var elm = element,
		doc = elm.document,
		border = doc.createElement("select-border-ie"),
		wrap = doc.createElement("select-wrap-ie"),
		bgColor = elm.currentStyle.backgroundColor.replace("transparent", "#fff"),
		pos = ["Bottom", "Right", "Left", "Top"],
		css = ["Style", "Color", "Width"],
		text, arrow;
	
	if(elm.multiple || elm.size > 1){
		return;
	}

	with(elm.runtimeStyle){
		verticalAlign = "top";
		selectfix = "none";
		height = "auto";
		margin = -2;
	}

	for(var i = 0; i < pos.length; i++){
		for(var j = 0; j < css.length; j++){
			arrow = "border" + pos[i] + css[j];
			border.style[arrow] = elm.currentStyle[arrow];
		}
		arrow = "padding" + pos[i];
		border.runtimeStyle[arrow] = elm.currentStyle[arrow];
	}

	with(border.runtimeStyle){
		maxWidth = elm.currentStyle.maxWidth;
		minWidth = elm.currentStyle.minWidth;
		width = elm.currentStyle.width;
		verticalAlign = "middle";
		background = bgColor;
		textAlign = "center";
		display = "inline";
		zoom = 1;
	}

	with(wrap.runtimeStyle){
		position = "relative";
		overflow = "hidden";
		display = "inline";
		zoom = 1;
	}

	border.onfocusin = function() {
		border.runtimeStyle.borderColor = "#79c0f2";
	}

	border.onfocusout = function() {
		border.runtimeStyle.borderColor = "";
	}

	if("XMLHttpRequest" in window){
		border.style.borderStyle = "solid";
	} else {
		text = doc.createElement("select-text-ie");
		arrow = doc.createElement("select-arrow-ie");

		with(arrow.runtimeStyle){
			borderLeft = borderRight = "4px solid " + bgColor;
			top =  elm.offsetHeight / 2 - 3;
			borderTop = "4px solid #000";
			position = "absolute";
			overflow = "hidden";
			height = width = 0;
			right = 3;
		}

		with(text.runtimeStyle){
			lineHeight = elm.offsetHeight - 4 + "px";
			fontSize = elm.currentStyle.fontSize;
			color = elm.currentStyle.color;
			fontFamily = "Arial, SimSun";
			verticalAlign = "baseline";
			position = "absolute";
			zoom = 1;
			left = 3;
			top = 0;
		}

		function visible(val){
			with(elm.runtimeStyle){
				position = val ? "relative" : "static";
				left = val;
			}
		}

		function show(){
			visible("");
		}
	
		function hide(){
			visible(-9999);
		}

		border.onmouseenter = show;
		border.onmouseleave = hide;

		wrap.appendChild(arrow);
		wrap.appendChild(text);

		function change(){
			text.innerHTML = elm.options[elm.selectedIndex].innerHTML + "&nbsp;";
		}
		change();
		hide();
		
		elm.attachEvent("onchange",change);
	}

	border.appendChild(wrap);
	elm.parentNode.insertBefore(border, elm);
	wrap.appendChild(elm);
}

(function(win,udf){
	document.createStyleSheet("", 0).addRule("select", "selectfix:expression(selectfix(this));");
})(this);
